package com.cc.bsp.persistence.hibernate;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Map;

import org.hibernate.Criteria;
import org.hibernate.criterion.Criterion;

import com.cc.bsp.persistence.IEntityDao;
import com.cc.bsp.persistence.IQueryPageOrder;
import com.cc.bsp.persistence.entity.IEntity;
import com.cc.bsp.persistence.exception.PersistenceException;

public interface IHEntityDao<T extends IEntity, ID extends Serializable>extends IEntityDao<T, ID> {
	void save(final T entity) throws PersistenceException;
	
	void update(final T entity) throws PersistenceException;
	
	void deleteById(final ID id) throws PersistenceException;
	
	void delete(final T entity) throws PersistenceException;

	void deleteBatch(final List<T> list) throws PersistenceException;

	void add(final T entity) throws PersistenceException;

	void addBatch(final List<T> list) throws PersistenceException;
	
	T findById(final ID id) throws PersistenceException;

	T findUniqueBy(final String propertyName, final Object propertyValue)throws PersistenceException;
	
	List<T> get(final Collection<ID> ids)throws PersistenceException;
	
	List<T> get(final Collection<ID> ids,final IQueryPageOrder pageorder)throws PersistenceException;
	
	List<T> findList(final String propertyName, final Object propertyValue)throws PersistenceException;
	
	List<T> findList(final String propertyName, final Object propertyValue,final IQueryPageOrder pageorder)throws PersistenceException;
	
	List<T> findList(final T entity) throws PersistenceException;
	
	List<T> findList(final T entity,final IQueryPageOrder pageorder) throws PersistenceException;
	
	List<T> findAll() throws PersistenceException;
	
	List<T> findAll(final IQueryPageOrder pageorder)  throws PersistenceException;
	
	long getCount(Criteria c) throws PersistenceException;
	
	long getCount(final String hql, final T entity) throws PersistenceException;
	
	long getCount(final String hql) throws PersistenceException;
	
	long getCount(final String hql,final Map<String,Object> map) throws PersistenceException;

	List<T> findList(final Criterion... criterions) throws PersistenceException;
	
	List<IEntity> findList(String hql, T entity,final IQueryPageOrder pageorder) throws PersistenceException;
	
	

}
